<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <title>详情页</title>
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/semantic.css"/>
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/common.css">
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/main.css">
     <script src="__PUBLIC__/Js/flickity-docs.min.js"></script>
 </head> 
 <body> 
 
  <form name="form3" method="post" action="__URL__/gouwuAC">
  <div class="pusher">

<!--       <div class="banner">
          <div class="de-img">
           <img src="{$prs['img']}" alt="img" class="half-img">
          </div>
 -->        </div>
          <div class="hero-gallery js-flickity">
            <div class="hero-gallery__cell hero-gallery__cell--1">
              <div class="content-wrap">
                <img src="{$prs['img']}" alt="img" class="half-img">
              </div>
            </div>
            <div class="hero-gallery__cell hero-gallery__cell--2">
              <div class="content-wrap">
                <img src="{$prs['img']}" alt="img" class="half-img">
              </div>
            </div>
            <div class="hero-gallery__cell hero-gallery__cell--3">
              <div class="content-wrap">
                <img src="{$prs['img']}" alt="img" class="half-img">
              </div>
            </div>
           
        </div><!-- 幻灯片   end -->

      <div class="goods-info" style="margin-top:0;">
         <div class="or-box">
            <h4>产品名称：{$prs.name}</h4>
          </div>
           <div class="or-box">
            <h4>产品编号：{$prs.id}</h4>
          </div>
          <div class="sbox">  
              <ul>
                  <li>
                    <div class="Spinner">
                      <input type="button" value="-" class="jian" />
                      <span class="shuliang">0</span>
                      <input type="button" value="+" class="jia" />
                    </div><br>
                    <div class="danjia">售价：<span>{$prs.money}元</span></div><br>
                    <div class="zongji">小计：<span>{$prs.money}元</span></div>
                  
                </li>
              </ul>
         </div>
         <div class="or-box">
         <!--<input type="submit" name="action" value="立即购买" onclick="{if(confirm('确定立即购买吗?')){return true;}return false;}" class="ui orange button">
        &nbsp;&nbsp;
         <input type="submit" name="action" value="加入购物车" onclick="{if(confirm('确定加入购物车吗?')){return true;}return false;}" class="ui red basic button">-->
        <input name="pid" type="hidden" class="ipt"  id="UserCode" value="{$rs.id}"/>
        <input name="id" type="hidden" class="ipt"  id="id" value="{$prs.id}"/>
        <input name="cptype" type="hidden" class="ipt"  id="cptype" value="{$prs.cptype}"/>
        <input name="nums" type="hidden" class="ipt"  id="nums" value=""/>
         </div>
      </div>

      <div class="goods-info">
          <div class="ui inverted vertical masthead white segment">
            <div class="title">
                <p>产品详情</p>
            </div>
            <div class="banner">
             {$prs['content']}
          </div>
      </div>

  </div>
  </form>
 <script>
     var oUl=document.getElementsByTagName('ul')[0];
     var aLi=oUl.getElementsByTagName('li');
     var aEm=document.getElementsByTagName('em');
     var goodsnum=document.getElementById("nums");
     console.log(goodsnum);
     var oStrong=document.getElementsByTagName('strong')[0];
     var total=0;
     var countprice=0;
     var max=0;
     for (var i = 0; i < aLi.length; i++) {
         shop(aLi[i]);
     };

     function shop(obj){
         var aInp=obj.getElementsByTagName('input');
         var aSpan=obj.getElementsByTagName('span');
         var num=parseInt(aSpan[0].innerHTML);
         var price=parseFloat(aSpan[1].innerHTML);
         aInp[0].onclick=function(){
             if(num<=0)return;
             num--;
             aSpan[0].innerHTML=num;
             goodsnum.value=num;
             aSpan[2].innerHTML=num*price+'元';
             total--;
             countprice-=price;
             aEm[0].innerHTML=total;
             oStrong.innerHTML=countprice;
             setmax();


         }
         aInp[1].onclick=function(){
             num++;
             aSpan[0].innerHTML=num;
             goodsnum.value=num;
             aSpan[2].innerHTML=num*price+'元';
             total++;
             countprice+=price;
             aEm[0].innerHTML=total;
             oStrong.innerHTML=countprice;
             setmax();
         }

     }
     function setmax(){
         max=0;
        for (var i = 0; i < aLi.length; i++) {
             var aSpan=aLi[i].getElementsByTagName('span');
             if(aSpan[0].innerHTML>0){
                 if(max<parseFloat(aSpan[1].innerHTML)){
                     max=parseFloat(aSpan[1].innerHTML);
                 }
             }
         aEm[1].innerHTML=max;
     }
         
     

 }
</script>
<div style="height:70px;background-color:#fff;"></div>
  <include file="Public:footer" />